using System;
using System.Runtime;
using Godot;

public partial class EnemyPatrol : BehaviorBase
{
    private int patrolTime = 200;

    public override BehaviorResult tick(Node _actor, Node _blackBoard)
    {
        var node = (Enemy)_actor;
        /*var waitTime = (int)BlackBoardUtil.GetValue(_blackBoard, "waitTime");
        GD.Print("所以这个是子方法吗>11111", waitTime);
        var moveTime = (int)BlackBoardUtil.GetValue(_blackBoard, "moveTime");
        if (waitTime > 0)
        {
            waitTime--;
            BlackBoardUtil.SetValue(_blackBoard, "waitTime", waitTime);
            return BehaviorResult.FAILURE;
        }
        if (moveTime > 0)
        {
            moveTime--;
            node.MoveRound();
            BlackBoardUtil.SetValue(_blackBoard, "moveTime", moveTime);
            return BehaviorResult.SUCCESS;
        }

        if (new Random().Next(5) == 1)
        {

            BlackBoardUtil.SetValue(_blackBoard, "waitTime", 200);

        }
        else
        {
            BlackBoardUtil.SetValue(_blackBoard, "moveTime", 200);
        }
        return BehaviorResult.RUNNING;*/
        return BehaviorResult.FAILURE;
        if (patrolTime >= 0)
        {
            GD.Print(node.Name + "巡逻中" + patrolTime);
            patrolTime--;
            node.MoveRound();
            return BehaviorResult.RUNNING;
        }
        else
        {
            GD.Print(node.Name + "暂停巡逻");
            patrolTime = 200;
            return BehaviorResult.SUCCESS;
        }




    }
}